package src.com.foreknow.demo12;

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Application extends Frame implements ActionListener {
    public Application(){

    }
    private Application(String title,int width,int height){
        Button button = new Button("login");
        Application application = new Application();
        button.addActionListener(application);
        this.add(button);
        this.setTitle(title);
        this.setSize(width,height);
        this.setVisible(true);
    }
    @Override
    public void actionPerformed(ActionEvent e) {
        System.out.println("哈哈...");
        }
        public static void main(String[] args) {
        Application application = new Application("这是一个窗口",400,400);
//        Frame frame = new Frame();
//        Button button = new Button("login");
//        //给button添加一个事件
////        ActionListener actionListener = new ActionListenerImpl();
//        Application application = new Application();
//        button.addActionListener(application);
//        frame.add(button);
//        frame.setTitle("这是一个窗口");
//        frame.setSize(400,400);
//        frame.setVisible(true);
    }



}










